package org.aurora.model.entity;

import org.aurora.common.util.UUIDUtil;
import org.aurora.model.type.ScheduleTaskState;

import java.util.Date;

public class ScheduleTask {
    public ScheduleTask(Task task, int triggerType) {
        this.task = task;
        this.triggerType = triggerType;
        this.uniqueId = UUIDUtil.uuid();
        this.state = ScheduleTaskState.INIT.getCode();
    }

    /**
     * 关联的任务
     */
    private Task task;

    /**
     * 调度任务唯一标识
     */
    private String uniqueId;

    /**
     * 预期调度时间
     */
    private Date expectedSchedulerTime;

    /**
     * 实际调度时间
     */
    private Date actualSchedulerTime;

    /**
     * 状态
     * @see org.aurora.model.type.ScheduleTaskState
     */
    private int state;

    /**
     * 执行时间
     */
    private long executionTime;

    /**
     * 触发类型
     * @see org.aurora.model.type.TaskTriggerType
     */
    private int triggerType;

    public Task getTask() {
        return task;
    }

    public void setTask(Task task) {
        this.task = task;
    }

    public String getUniqueId() {
        return uniqueId;
    }

    public void setUniqueId(String uniqueId) {
        this.uniqueId = uniqueId;
    }

    public Date getExpectedSchedulerTime() {
        return expectedSchedulerTime;
    }

    public void setExpectedSchedulerTime(Date expectedSchedulerTime) {
        this.expectedSchedulerTime = expectedSchedulerTime;
    }

    public Date getActualSchedulerTime() {
        return actualSchedulerTime;
    }

    public void setActualSchedulerTime(Date actualSchedulerTime) {
        this.actualSchedulerTime = actualSchedulerTime;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public long getExecutionTime() {
        return executionTime;
    }

    public void setExecutionTime(long executionTime) {
        this.executionTime = executionTime;
    }

    public int getTriggerType() {
        return triggerType;
    }

    public void setTriggerType(int triggerType) {
        this.triggerType = triggerType;
    }
}
